package com.woori;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

public class TestFooBar {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// new Foo(new Bar()).doFoo();
		Resource resource = new ClassPathResource("applicationContext.xml");
		BeanFactory factory = new XmlBeanFactory(resource);
		Foo foo = (Foo) factory.getBean("foo");
		foo.doFoo();

		ApplicationContext ctx = new ClassPathXmlApplicationContext(
				"applicationContext2.xml");
		Foo foo2 = (Foo) ctx.getBean("foo");
		Foo foo0 = (Foo) ctx.getBean("foo");
		foo2.doFoo();

		if (foo0 == foo2) {
			System.out.println("true");
		}
	}

}
